
import Constants from '../constants/constants';

const USERS = [
  { id: 1, name: '古巨基', avatar: 'http://img3.imgtn.bdimg.com/it/u=3195397792,3510509553&fm=27&gp=0.jpg', gender: 1 },
  { id: 2, name: '刘德华', avatar: 'http://img4.imgtn.bdimg.com/it/u=4061870120,3743716032&fm=27&gp=0.jpg', gender: 1 },
  { id: 3, name: '江一燕', avatar: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1328828180,1777408258&fm=27&gp=0.jpg', gender: 0 },
  { id: 4, name: '吴越', avatar: 'http://img5.imgtn.bdimg.com/it/u=840208331,1123458960&fm=27&gp=0.jpg', gender: 0 },
  { id: 5, name: '张学友', avatar: 'http://img0.imgtn.bdimg.com/it/u=901291112,3346361686&fm=27&gp=0.jpg', gender: 1 },
  { id: 6, name: '张梓琳', avatar: 'http://img2.imgtn.bdimg.com/it/u=4148793858,2393786154&fm=27&gp=0.jpg', gender: 0 },
  { id: 7, name: '韩庚', avatar: 'http://img0.imgtn.bdimg.com/it/u=2462332269,4206412339&fm=27&gp=0.jpg', gender: 1 },
  { id: 8, name: '陈赫', avatar: 'http://img2.imgtn.bdimg.com/it/u=309034161,2736030131&fm=27&gp=0.jpg', gender: 1 },
  { id: 9, name: '刘诗诗', avatar: 'http://img4.imgtn.bdimg.com/it/u=2867947746,3187697960&fm=27&gp=0.jpg', gender: 0 },
  { id: 10, name: '邓超', avatar: 'http://img1.imgtn.bdimg.com/it/u=770588676,1773900079&fm=27&gp=0.jpg', gender: 1 },
  { id: 11, name: '赵立新', avatar: 'http://img1.imgtn.bdimg.com/it/u=3513269396,3226872171&fm=11&gp=0.jpg', gender: 1 },
  { id: 12, name: '张歆艺', avatar: 'http://img2.imgtn.bdimg.com/it/u=918970674,2402112200&fm=27&gp=0.jpg', gender: 0 },
  { id: 13, name: '赵丽颖', avatar: 'http://img3.imgtn.bdimg.com/it/u=2040929712,3033480349&fm=27&gp=0.jpg', gender: 0 },
  { id: 14, name: '黄渤', avatar: 'http://img2.imgtn.bdimg.com/it/u=2945701400,1133896194&fm=27&gp=0.jpg', gender: 1 },
  { id: 15, name: '林志玲', avatar: 'http://img3.imgtn.bdimg.com/it/u=1769420783,2385344848&fm=27&gp=0.jpg', gender: 0 },
];

const TIMEOUT = 2000;

export async function login() {

  return new Promise((resolve, reject) => {

    setTimeout(() => {
      resolve({
        data: { item: USERS[10] },
        code: Constants.Code.SUCCESS
      })
    }, TIMEOUT);
  });
}

export async function getList() {

  return new Promise((resolve, reject) => {

    setTimeout(() => {
      resolve({
        data: { 
          items: USERS.slice(0, 10),
          page: { total: USERS.length }
        },
        code: Constants.Code.SUCCESS
      });
    }, TIMEOUT);
  });
}

export async function remove() {

  return new Promise((resolve, reject) => {

    setTimeout(() => {
      resolve({ code: Constants.Code.SUCCESS })
    }, 500)
  });
}